# coding:utf-8
# writingtime: 2022-8-9

import math


class ScoreFunction:
    def __init__(self, IVq, q):
        """
        function: 戴丽的得分函数
        :param IVq:
        :param q:
        """
        self.data = IVq
        self.q = q

    def getScore(self):
        """
        function: 计算结果
        :return:
        """
        a = self.data
        q = self.q
        temp1 = (a[0][0] ** q + a[0][1] ** q + ((a[0][0] + a[0][1]) / 2) ** q) / 3
        temp2 = (a[1][0] ** q + a[1][1] ** q + ((a[1][0] + a[1][1]) / 2) ** q) / 3
        temp3 = (a[0][0] ** q - a[1][0] ** q + a[0][1] ** q - a[1][1] ** q) / 2
        temp4 = math.cos(((a[0][0] ** q + a[0][1] ** q) * math.pi) / 4)
        temp5 = math.cos(((a[1][0] ** q + a[1][1] ** q) * math.pi) / 4)
        result = (temp1 - temp2 + temp3 - temp4 + temp5) / 3
        return result


if __name__ == "__main__":
    a=([0.83618, 0.91809], [0.08191, 0.16382])
    print(ScoreFunction(a,3).getScore())
